n = input().split()
numbers = ['zero','one','two','three','four','five','six','seven','eight','nine']
vivod = ''
if len(n) != 3:
    vivod = 'Wrong input'
else:
    for word in n:
        if word not in numbers:
            vivod = 'Wrong input'
            break
        vivod += str(numbers.index(word))
    if len(vivod) != 3:
        vivod = 'Wrong input'

if vivod != 'Wrong input':
    num = int(vivod)
    found = False
    while not found:
        if num > 1:
            is_prime = True
            for i in range(2, int(num ** 0.5) + 1):
                if num % i == 0:
                    is_prime = False
                    break
            if is_prime:
                print(num)
                found = True
            else:
                num += 1
        else:
            num += 1
else:
    print(vivod)
